home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_clock.cog < prev    next >
Text File  |  1999-11-15  |  22KB  |  621 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SHS_Clock.cog      Set the clock for the bellringer to come out.  
  4. #
  5. # [PKM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message        activated
  14. message        startup
  15. message        timer
  16. message        pulse
  17. message        arrived
  18. message        callback
  19. message        user0
  20. message        user1
  21. message        user2
  22. message        crossed
  23.  
  24. surface        soundon
  25. surface        soundoff
  26.  
  27. thing        hourHand
  28. thing        minuteHand
  29. thing        bellRinger
  30. thing        gearTick
  31. thing        spokeThing        // 12 o'clock
  32. thing        spokeThing1        // 1 o'clock
  33. thing        spokeThing2        // 2 o'clock
  34. thing        spokeThing3        // 3 o'clock
  35. thing        spokeThing4        // 4 o'clock
  36. thing        spokeThing5        // 5 o'clock
  37. thing        spokeThing6        // 6 o'clock
  38. thing        spokeThing7        // 7 o'clock
  39. thing        spokeThing8        // 8 o'clock
  40. thing        spokeThing9        // 9 o'clock
  41. thing        spokeThing10    // 10 o'clock
  42. thing        spokeThing11    // 11 o'clock
  43. thing        spokeSwitch
  44. thing        indy
  45. thing        indyMark                                            // Mark that Indy gets teleported to when throwing the switch
  46. thing        indyMark2                                            // Mark that Indy gets teleported to after throwing the switch
  47. thing        ClockGhost                                            // Ghost object to force clock hand orientation.
  48. thing        clockCamera                                    nolink    // Camera position for viewing the clock face
  49. thing        clockCameraTarget                            nolink    // Moving target to track from Indy to the clock
  50. thing        bellRingerCamera                            nolink    // Camera for viewing bellringer
  51. thing        bellRingerCamera2                            nolink    // Camera for viewing bellringer
  52. thing        bellRingerCameraTarget                        nolink    // Target for viewing bellringer
  53. thing        bellRingerCameraTarget2                        nolink    // Target for viewing bellringer second time
  54. thing        player                                        local
  55. thing        currentCamera                                local
  56. thing        indyTeleportGhost                            local
  57.  
  58. cog            hintCog                                            # Update Hint cog
  59. cog            movieCog                                        // COG that controls the switch to start moving the bellringer.
  60. cog            NoWorkTalkcog                                    # clock not powered
  61.  
  62. keyframe    indyPull=in_pull_lever_down.key                local
  63. keyframe    leverDown=gen_lever.key                        local
  64. keyframe    bellRingerSpin=0ri_roll_fwd_nowheels.key    local
  65. keyframe    gear_tick_k
  66.  
  67.  
  68. sound        leverPull=nub_lever_pull_c.wav                local
  69. sound        leverBack=nub_lever_reset_c.wav                local
  70. sound         minute_sound=shs_ticking.wav                local
  71. sound        hour_sound=shs_clockhand.wav                local        
  72. sound        bellringer_start=shs_bringer_start.wav         local
  73. sound        bellringer_spin=shs_bringer_spin.wav        local
  74. sound        spoke_move=shs_clock_tab.wav                local
  75. sound         music=mus_gen_magic1.wav                    local
  76. sound        gearTicking=shs_gear_clunk2.wav                local
  77.  
  78.  
  79. vector        cameraPosition                                local
  80. vector        minuteHandYaw                                local    // Vector for computing new orientation of minute hand.
  81. vector        indyTeleportOffset                            local    // Vector for offset of Indy's teleport position.
  82. vector        indyTeleportPos                                local    // Vector for final position to teleport Indy to.
  83. vector        indyOrient                                    local
  84. vector        indyTeleportOrient                            local
  85.  
  86. template    ghostTemplate=ghost                            local
  87.  
  88. int            spokeIndex=-1                                local
  89. int            minuteHandIndex                                  local    // Start position of the minute hand in minutes - must match placement of 3DO in world.
  90. int            hourHandIndex                                local    // Start position of the hour hand in hours - must match placement of 3DO in the world.
  91. int            clockIsPowered                                local    // This should be set to 1 after we receive the appropriate message.
  92. int            bellRingerSpinning                            local    // Whether the bellringer is currently spinning.
  93. int            leverPullCount                                local    // Whether the lever has been pulled yet.
  94. int            cutsceneGoing                                local    // Whether ot not a cutscene is currently playing.
  95. int            spinTrack                                    local    // Keyframe track of the bellringer spinning.
  96. int            stopBellRingerOnCallback                    local    // Indicates to the callback message that the bellringer needs to stop.
  97. int            waitForHourHand                                local    // Set to 0 by the arrived message when the hour hand reaches its mark.
  98. int            minuteCountdown                                local    // Number of seconds left in current spoke movement mini-cutscene
  99. int            bBellRingerShowing                            local    // Whether camera is currently showing bellringer    
  100. int            spinLoop                                    local    // loop of spinning 
  101. int            gearLoop                                    local   // loop of ticking
  102. int            gearTick_track                                local   // loop of anim
  103. int            canHear=0                                    local    // clock sounds in range    
  104.  
  105. flex        minuteTime=1.0;                                local    // One minute of real time equals this number of seconds.
  106. flex        minuteRotateTime=0.25;                        local    // The minute hand takes this many of seconds to get to its next position.
  107. flex        hourRotateTime=0.5;                            local    // The hour hand takes this many seconds to get to its next position.
  108. flex        spokeMoveSpeed=1.0;                            local    // Spokes move this fast when going to their new positions.
  109. flex        bellRingerCameraMoveSpeed=0.3                local    // Speed at which the bell ringer camera moves.
  110. flex        bellRingerCameraTargetMoveSpeed=0.19        local    // Speed at which the bell ringer camera target moves.
  111.  
  112. #SUBROUTINES
  113.  
  114. flex        startbellringer                                local
  115. flex        stopbellringer                                local
  116. flex        pulllever                                    local
  117. flex          clockCutscene                                local
  118.  
  119.  
  120. end
  121.  
  122. # ========================================================================================
  123.  
  124. code
  125.  
  126.  
  127. startup:
  128.     spokeIndex = -1;        // -1 means the spokes have never been moved.
  129.     minuteHandIndex = 10;    // This needs to be set one minute behind the actual placement of the 3DO
  130.     hourHandIndex = 10;        // Current position of the hour hand.  The hands are placed in the level at 10:00 and 2:00.
  131.     bellRingerSpinning = 0;
  132.     leverPullCount = 0;
  133.     cutsceneGoing = 0;
  134.     stopBellRingerOnCallback = 0;
  135.     waitForHourHand = 0;
  136.     bBellRingerShowing = 0;
  137.  
  138. //    clockIsPowered = 1;
  139. //    SetPulse(minuteTime);    // This should actually happen after we get the clock powered message.
  140.  
  141.     ClearThingFlags(bellringer, 0x80000); # reveal the bellringer
  142.     AISetMode(bellringer, 0x2000); # reveal the bellringer
  143.     SetThingMass(bellRinger, 0);
  144.  
  145.     spinTrack = PlayKey(bellRinger, bellRingerSpin, 4, 0x10, 0);
  146.     PauseKey(bellRinger, spinTrack);
  147.     SetThingLight(gearTick, '0.2 0.2 0.2', 0.01, 0.01);
  148.     SetThingLight(bellRinger, '0.1 0.1 0.1', 0.01, 0.01);
  149.     
  150.     return;
  151.  
  152. # ...................................................................
  153.  
  154. activated:
  155.        
  156.     # handles no power activation - JC
  157.     if ((clockIsPowered == 0) && (GetSenderRef() == spokeSwitch))
  158.     {
  159.         call pullLever;
  160.         SendMessageEx(NoWorkTalkCog, user1, 0, 0, 0, 0);
  161.         global15 = 0; # per Randy
  162.         while (global15 == 0)
  163.         {
  164.             Sleep(0.01); # wait for line to finish
  165.         }
  166.         # cleanup
  167.         cameraPosition = GetThingPos(clockCamera); 
  168.         SetCameraPosition(1, cameraPosition);            # prep to swing back to follow-cam
  169.  
  170.         CopyOrientAndPos(indy, player);                    # move player to actor's spot
  171.         SetThingFlags(indy, 0x80000);                    # hide actor
  172.  
  173.         ClearThingFlags(player, 0x80000);                # player visible
  174.         ClearActorFlags(player, 0x200000);                # player in control
  175.  
  176.         SetCameraLookInterp(2, 0);                        # kill pan & tilt mode
  177.         SetCameraPosInterp(2, 0);                        # kill dolly mode
  178.  
  179.         Sleep(0.01);
  180.         ResetCameraFOV(0, 0.0);                            # reset camera 2 to default
  181.         SetCurrentCamera(1);
  182.         
  183.         EndCutscene();
  184.     }
  185.     
  186.  
  187.     if (clockIsPowered && !cutsceneGoing && (GetSenderRef() == spokeSwitch))
  188.     {
  189.         currentCamera = GetCurrentCamera();                            // Save off the current camera for later
  190.         if (leverPullCount > 0)
  191.         {
  192.             cutsceneGoing = 1;
  193.  
  194.             call pullLever;                                            // Show Indy pulling the lever
  195.  
  196.             SetCameraLookInterp(2, 0);                                // Kill pan & tilt mode
  197.             SetCameraPosInterp(2, 0);                                // Kill dolly mode
  198.             SetCameraFocus(2, clockCamera);
  199.             SetCameraSecondaryFocus(2, clockCameraTarget);            // Show the clock face while the spokes move.
  200.             SetCurrentCamera(2);
  201.             SetCameraFOV(55, 1, 0.01);
  202.             Sleep(0.01);
  203.  
  204.             if (spokeIndex < 0)
  205.             {
  206.                 spokeIndex = hourHandIndex;                            // No spoke is currently out - synch it to the hour hand.
  207.             }
  208.             else
  209.             {
  210.                 MoveToFrame(spokeThing[spokeIndex], 0, spokeMoveSpeed);    // Move current spoke back to former position.
  211.                 spokeIndex = (spokeIndex + 1) % 12;                        // Move the spoke one tick clockwise.
  212.             }
  213.  
  214.             MoveToFrame(spokeThing[spokeIndex], 1, spokeMoveSpeed);    // Move new spoke out to new position.
  215.             PlaySoundLocal(spoke_move, 1.0, 0, 0x0000, 0);
  216.  
  217.             minuteCountdown = 3;                                    // The minute hand decrements this variable.  When it reaches 0, stop the cutscene.
  218.             while (minuteCountdown)
  219.                 Sleep(0.01);
  220.  
  221.             if (spokeIndex == hourHandIndex)
  222.             {
  223.                 // If the player has just moved the spoke onto the hour hand, show the bellringer - briefly.
  224.  
  225.                 # Prep camera & cut...
  226.                 SetCameraLookInterp(2, 0);                                # kill pan & tilt to lock on 2nd target
  227.                 SetCameraPosInterp(2, 0);                                # kill dolly mode too
  228.                 SetCameraFocus(2, bellRingerCamera2);
  229.                 SetCameraSecondaryFocus(2, bellRingerCameraTarget2);
  230.                 SetCurrentCamera(2);
  231.                 SetCameraFOV(50, 0, 0.0);
  232.                 Sleep(0.001);
  233.                 SetCameraFOV(45, 1, 3.0);
  234.                 Sleep(3.0);
  235.             }
  236.         }
  237.         else
  238.         {
  239.             call clockCutscene;
  240.         }
  241.  
  242.         // We're currently showing a cutscene, either of the clock face or of Indy, so get things back to normal.
  243.  
  244.         cutsceneGoing = 0;
  245.  
  246.         cameraPosition = GetThingPos(clockCamera); 
  247.         SetCameraPosition(1, cameraPosition);            # prep to swing back to follow-cam
  248.  
  249.         CopyOrientAndPos(indy, player);                    # move player to actor's spot
  250.         SetThingFlags(indy, 0x80000);                    # hide actor
  251.  
  252.         ClearThingFlags(player, 0x80000);                # player visible
  253.         ClearActorFlags(player, 0x200000);                # player in control
  254.  
  255.         SetCameraLookInterp(2, 0);                        # kill pan & tilt mode
  256.         SetCameraPosInterp(2, 0);                        # kill dolly mode
  257.  
  258.         Sleep(0.01);
  259.  
  260.         if (leverPullCount)
  261.         {
  262.             TeleportThing(player, indyMark2);            // Get the player lined up with the switch better.
  263.         }
  264.         else
  265.         {
  266.             TeleportThing(player, indyTeleportGhost);    // Put the player over by the edge of the platform.
  267.             SetThingLVecPYR(player, indyTeleportOrient);
  268.         }
  269.  
  270.         leverPullCount = 1;
  271.  
  272.         SetCurrentCamera(currentCamera);
  273.         ResetCameraFOV(0, 0.0);
  274.  
  275.         EndCutscene();
  276.  
  277.         if (spokeIndex != hourHandIndex)
  278.         {
  279.             // The current spoke is not next to the hour hand - stop the bellringer.
  280.             if (bellRingerSpinning)
  281.                 stopBellRingerOnCallback = 1;
  282. //            call stopBellRinger;
  283.         }
  284.     }
  285.     
  286.     return;
  287.  
  288. # ...................................................................
  289. timer:
  290.     call pulse;
  291.     SetPulse(minuteTime);
  292.     return;
  293.  
  294. pulse:
  295.     Rotate(minuteHand, 6, 1, minuteRotateTime);            // Advance minuteHand 6 degrees (which is one minute)
  296.     minuteHandIndex = (minuteHandIndex + 1) % 60;        // Keep track of minutes (0 to 59 inclusive).
  297.     
  298.     # Check whether cutscene is happening. Play minute sound.
  299.     if ((cutsceneGoing == 0) || (bBellRingerShowing == 1))
  300.     {
  301.         if (canHear == 1)
  302.             PlaySoundThing(minute_sound, minuteHand, 1, 5, 20, 0x80);
  303.     }
  304.     else
  305.         PlaySoundLocal(minute_sound, .5, 0, 0x0000, 0);
  306.  
  307.     if (minuteCountdown > 0)
  308.         minuteCountdown = minuteCountdown - 1;
  309.  
  310.     if (minuteHandIndex == 0)
  311.     {
  312.         if (spokeIndex == hourHandIndex)
  313.         {
  314.             if (bellRingerSpinning)
  315.                 stopBellRingerOnCallback = 1;
  316. //            call stopBellRinger;        // The hour hand is about to move away from the correct spoke - stop the bellringer.
  317.         }
  318.  
  319.         if (hourHandIndex == spokeIndex)
  320.         {
  321.             // We're about to move the hour hand off the spoke, so retract the spoke.
  322.             MoveToFrame(spokeThing[spokeIndex], 0, spokeMoveSpeed);
  323.             spokeIndex = -1;
  324.         }
  325.  
  326.         Rotate(hourHand, 30, 1, hourRotateTime);        // Advance hour hand 30 degrees
  327.         hourHandIndex = (hourHandIndex + 1) % 12;        // Keep track of hours (0 to 11 inclusive).
  328.         
  329.         if ((cutsceneGoing == 0) || (bBellRingerShowing == 1))
  330.         {
  331.             if (canHear == 1)
  332.                 PlaySoundThing(hour_sound, hourHand, 1, 5, 18, 0x80);
  333.         }
  334.         else
  335.             PlaySoundLocal(hour_sound, .5,  0, 0x0000, 0);
  336.         
  337.     }
  338.  
  339.     return;
  340.  
  341. # ...................................................................
  342.  
  343. arrived:
  344.     if (cutsceneGoing == 2)        // If we're showing the big clock/bellringer cutscene, don't mess with the bellringer.
  345.     {
  346.         if (GetSenderRef() == hourHand)
  347.             waitForHourHand = 0;        // Make sure the cutscene knows the hour hand has arrived.
  348.         return;
  349.     }
  350.  
  351.     if ((GetSenderRef() == hourHand) || (GetSenderRef() == spokeThing[spokeIndex]))
  352.     {
  353.         if (hourHandIndex == 0)
  354.             CopyOrient(ClockGhost, hourHand);
  355.  
  356.         // The hour hand or a spoke has finished moving - check to see if we need to start the bellringer.
  357.  
  358.         if (spokeIndex == hourHandIndex)
  359.         {
  360.             // The hour hand has just run into the correct spoke - start the bellringer.
  361.             call startBellRinger;
  362.         }
  363.     }
  364.     else
  365.     {
  366.         if (minuteHandIndex == 0)
  367.             CopyOrient(ClockGhost, minuteHand);
  368.     }
  369.  
  370.     return;
  371.     
  372. # ...................................................................
  373. crossed:
  374.  
  375.     if (GetSenderRef() == soundOn) 
  376.     {
  377.         canHear = 1;
  378.     }
  379.     if (GetSenderRef() == soundOff)
  380.     {
  381.         canHear = 0;
  382.     }
  383.  
  384.     return;
  385.  
  386. # ...................................................................
  387. clockCutscene:
  388.     // This is the first time the player has pulled the lever - let's do a fancy cutscene to demonstrate what the lever does.
  389.  
  390.     cutsceneGoing = 2;
  391.  
  392.     SetPulse(0);                                    // Temporarily halt our pulse messages while we tweak the clock a bit.
  393.  
  394.     spokeIndex = (hourHandIndex + 1) % 12;            // Make the first spoke to move be just past the hour hand.
  395.  
  396.     StopThing(minuteHand);                            // If the minute hand is rotating, stop it.
  397.     minuteHandYaw = VectorSet(0.0, -24.0, 0.0);        // Yaw is in world coords.  0 degrees == 9 o'clock, -30 == 10 o'clock
  398.     RotateToPyr(minuteHand, minuteHandYaw, 0.01);    // Force the minute hand to the right position.
  399.     minuteHandIndex = 49;                            // NOTE: Make sure this matches the orientation specified in minuteHandYaw!!!
  400.  
  401.     SetPulse(minuteTime);                            // Start the clock again.
  402.  
  403.     call pullLever;                                    // Show the player pulling the lever.
  404.  
  405.     indyTeleportOffset = VectorTransformToOrient(indy, '0.0 -0.2 0.0');
  406.     indyTeleportPos = VectorAdd(indyTeleportOffset, GetThingPos(indy));
  407.     indyOrient = GetThingLVecPYR(indy);
  408.     indyTeleportOrient = VectorSet(VectorX(indyOrient), (VectorY(indyOrient) + 180) % 360, VectorZ(indyOrient));
  409.  
  410.     indyTeleportGhost = CreateThingAtPos(ghostTemplate,
  411.                                          FindNewSectorFromThing(indy, indyTeleportPos),
  412.                                          indyTeleportPos, '0 0 0');
  413.     SetThingMaxRotVel(indy, 50);
  414.     AISetLookThingEyeLevel(indy, indyTeleportGhost);
  415.  
  416.     SetCameraLookInterp(2, 1);                        # enable pan & tilt
  417.     Sleep(0.01);
  418.  
  419.     SetCameraInterpSpeed(2, 5.0);                    # magic numbers
  420.     SetCameraFocus(2, clockCamera);
  421.     SetCameraSecondaryFocus(2, clockCameraTarget);
  422.     SetCameraFOV(55, 1, 5.0);                        # match duration of camera move
  423.  
  424.     MoveToFrame(ClockCameraTarget, 1, 2.2);            # magic numbers
  425.  
  426.     Sleep(4.5);                                        // Wait for camera interp & FOV change to finish
  427.  
  428.     waitForHourHand = 1;                            // We need to wait for the hour hand to get to the next tick before we proceed.
  429.  
  430.     MoveToFrame(spokeThing[spokeIndex], 1, spokeMoveSpeed);    // Move new spoke out to new position.
  431.     PlaySoundLocal(spoke_move, 1.0, 0, 0x0000, 0);
  432.      
  433.     while (waitForHourHand == 1)                    // The arrived message will tell us when the hour hand is in place.
  434.         Sleep(0.5);
  435.  
  436.     call stopBellRinger;
  437.  
  438.     // Now cut to the bellringer.
  439.  
  440.     bBellRingerShowing = 1;
  441.  
  442.     # Prep camera & cut...
  443.     SetCameraLookInterp(2, 0);                                # kill pan & tilt to lock on 2nd target
  444.     SetCameraPosInterp(2, 0);                                # kill dolly mode too
  445.     SetCameraFocus(2, bellRingerCamera);
  446.     SetCameraSecondaryFocus(2, bellRingerCameraTarget);
  447.     SetCurrentCamera(2);
  448.     SetCameraFOV(90, 0, 0.0);
  449.     Sleep(0.01);
  450.  
  451.     # play music
  452.     PlaySoundLocal(music, 1.0, 0, 0x0000, 0);
  453.  
  454.     MoveToFrame(bellRingerCamera, 1, bellRingerCameraMoveSpeed);    // Dolly us in a bit.
  455.     MoveToFrame(bellRingerCameraTarget, 1, bellRingerCameraTargetMoveSpeed);
  456.  
  457.     SetCameraFOV(50, 0, 6.0);
  458.     Sleep(1.0);
  459.  
  460.     PlaySoundLocal(bellringer_start, 1.0, 0, 0x0, 0);
  461.     ResumeKey(bellRinger, spinTrack);                // Start the bellringer spinning.
  462.     spinLoop=PlaySoundLocal(bellringer_spin, 1.0, 0, 0x0001, 0);
  463.  
  464.     Sleep(6.0);                                        // Wait a bit while we dolly & zoom in.
  465.  
  466.     // Time for some more trickery - we're going to pretend that a full minute has gone by and show the player what happens
  467.     // when the hour hand moves off the spoke.
  468.  
  469.     stopBellRingerOnCallback = 1;                    // Tell the endanim callback to stop the bell ringer.
  470.     while (stopBellRingerOnCallback == 1)            // Wait for the animation callback to tell us we're stopped.
  471.         Sleep(0.1);
  472.     Sleep(1.0);                                        // Allow the player time to contemplate the fact that he's stopped.
  473.  
  474.     SetPulse(0);
  475.     StopThing(minuteHand);                            // If the minute hand is rotating, stop it.
  476.     minuteHandYaw = VectorSet(0.0, -84.0, 0.0);        // Yaw is in world coords.  0 degrees == 9 o'clock, -30 == 10 o'clock.
  477.     RotateToPyr(minuteHand, minuteHandYaw, 0.001);    // Force the minute hand to the right position.
  478.     minuteHandIndex = 59;                            // NOTE: Make sure this matches the orientation specified in minuteHandYaw!!!
  479.     Sleep(0.001);                                    // Give the minute hand time to get where it's going.
  480.     SetTimer(0.1);                                    // Start the clock again.
  481.  
  482.     bBellRingerShowing = 0;
  483.     
  484.     SetCameraLookInterp(2, 0);                        # kill pan & tilt to lock on 2nd target
  485.     SetCameraPosInterp(2, 0);                        # kill dolly mode too
  486.     SetCameraFocus(2, clockCamera);
  487.     SetCameraSecondaryFocus(2, clockCameraTarget);
  488.     SetCurrentCamera(2);
  489.     SetCameraFOV(55, 0, 0.01);
  490.  
  491.     minuteCountdown = 2;                            // The minute hand decrements this variable.  When it reaches 0, stop the cutscene.
  492.     while (minuteCountdown)
  493.         Sleep(0.01);
  494.  
  495.     return;
  496.  
  497.  
  498. startBellRinger:
  499.     stopBellRingerOnCallback = 0;
  500.     if (bellRingerSpinning == 0)
  501.     {
  502.         PlaySoundThing(bellringer_start, bellringer, 1, 3, 10, 0x80);
  503.         ResumeKey(bellRinger, spinTrack);            // Start the bellringer spinning.
  504.         spinLoop=PlaySoundThing(bellringer_spin, bellringer, 1, 3, 10, 0x81);
  505.         
  506.         bellRingerSpinning = 1;
  507.         SendMessage(movieCog, user1);                    // Send the bell cog a user1 message to let it know we're spinning.
  508.         SendMessage(hintCog, user1);                    # Same as above, except to hint cog.
  509.     }
  510.  
  511.     return;
  512.  
  513. # ...................................................................
  514.  
  515. stopBellRinger:
  516.     if (bellRingerSpinning == 1)
  517.     {
  518.         PauseKey(bellRinger, spinTrack);
  519.         StopSound(spinLoop, 0.0);
  520.         bellRingerSpinning = 0;
  521.         SendMessage(movieCog, user0);                    // Send the bell cog a user0 message to let it know we've stopped.
  522.         SendMessage(hintCog, user0);                    # same as above, except to hint cog
  523.         
  524.     }
  525.  
  526.     return;
  527.  
  528. pullLever:
  529.     player = GetLocalPlayerThing();
  530.  
  531.     # Prep for cutscene...
  532.     StartCutscene(1);
  533.     currentCamera = GetCurrentCamera();
  534.     
  535.     # Disable and hide player...
  536.     StopThing(player);                    # right now
  537.     PlayMode(player, 1, 0);                # get him into a nice stand
  538.     DeselectWeapon(player);                # stow any weapon or lighter
  539.     
  540.     CopyPlayerHolsters(player, indy);    # make sure our actor has matching props
  541.     Sleep(0.5);                            # give him some time to do his stuff
  542.     
  543.     # Switch actor indy for player...
  544.     TeleportThing(indy, indyMark);
  545.     SetThingFlags(player, 0x80000);        # hide him
  546.     SetActorFlags(player, 0x200000);    # paralyze him
  547.     ClearThingFlags(indy, 0x80000);        # reveal our actor
  548.     
  549.     # Prep camera & cut...
  550.     SetCameraLookInterp(2, 0);            # kill pan & tilt to lock on 2nd target
  551.     SetCameraPosInterp(2, 0);            # kill dolly mode too
  552.     SetCameraFocus(2, clockCamera);
  553.     SetCameraSecondaryFocus(2, indyMark);
  554.     SetCurrentCamera(2);
  555.     SetCameraFOV(35, 0, 0.01); # was 50
  556.     Sleep(0.01);
  557.  
  558.     PlayKey(spokeSwitch, leverDown, 4, 0x12, 0);
  559.     PlayKey(indy, indyPull, 4, 0x12, 0);
  560.     Sleep(1.2);
  561.     PlaySoundLocal(leverPull, 1.0, 0, 0x0000, 0);
  562.     Sleep(1.4);
  563.     PlaySoundLocal(leverBack, 1.0, 0, 0x0000, 0);
  564.     Sleep(0.3);
  565.  
  566.     return;
  567.  
  568. callback:
  569.     // We've reached the end of the bellringer spin animation.  Check to see if we need to stop him.
  570.     if (stopBellRingerOnCallback == 1)
  571.     {
  572.         StopThing(bellRingerCamera);            // Stop the camera.
  573.         StopThing(bellRingerCameraTarget);        // And the camera target.
  574.         PauseKey(bellRinger, spinTrack);        // Now stop the bellringer.
  575.         StopSound(spinLoop, 0.0);
  576.         stopBellRingerOnCallback = 0;
  577.         bellRingerSpinning = 0;
  578.     }
  579.     return;
  580.  
  581. user0:
  582.     // We're being told that the clock is no longer powered.
  583.     clockIsPowered = 0;
  584.     SetPulse(0);
  585.     if (bellRingerSpinning)
  586.         stopBellRingerOnCallback = 1;
  587. //    call stopBellRinger;
  588.     StopKey(gearTick, gearTick_track, 0);
  589.     StopSound(gearLoop, 0.0);
  590.     
  591.     return;
  592.  
  593. user1:
  594.     // We're being told that the clock is now powered, so start things up!
  595.     clockIsPowered = 1;
  596.     SetPulse(minuteTime);
  597.     if (spokeIndex == hourHandIndex)
  598.         call startBellRinger;
  599.     gearTick_track=PlayKey(gearTick, gear_tick_k, 4, 0x10, 0);
  600.     gearLoop=PlaySoundThing(gearTicking, gearTick, 1, 2, 8, 0x81);
  601.     
  602.     
  603.     return;
  604.  
  605. user2:
  606.     // We're being told to stop the bellringer from spinning.
  607.     StopKey(bellRinger, spinTrack, 0);
  608.     spinTrack = PlayKey(bellRinger, bellRingerSpin, 4, 0x10, 0);
  609.     PauseKey(bellRinger, spinTrack);
  610.     StopSound(spinloop, 0.0);
  611.     bellRingerSpinning = 0;
  612.     stopBellRingerOnCallback = 0;
  613.     SendMessage(movieCog, user0);                    // Send the bell cog a user0 message to let it know we've stopped.
  614.     SendMessage(hintCog, user0);                    # same as above, except to hint cog
  615.     MoveToFrame(spokeThing[spokeIndex], 0, spokeMoveSpeed);
  616.     spokeIndex = -1;
  617.  
  618.     return;
  619.  
  620. end
  621.